package com.lindroy.androidplayer.ui.login

import com.lindroy.androidplayer.R
import com.lindroy.androidplayer.base.BaseActivity

/**
 * @author Lin
 * @date 2021/4/9
 * @function 登录页面
 * @Description
 */
class LoginActivity(override val layoutId: Int = R.layout.activity_login) : BaseActivity(),
    LoginFragment.OnRegisterClickListener, RegisterFragment.OnLoginClickListener {

    private val loginFragment: LoginFragment by lazy { LoginFragment.newInstance() }
    private val registerFragment: RegisterFragment by lazy { RegisterFragment.newInstance() }

    override fun initView() {
        initToolBar("", true)
        supportFragmentManager.beginTransaction().add(R.id.flContainer, loginFragment).commit()

    }

    override fun initData() {

    }

    override fun initListener() {


    }

    override fun initClick() {

    }

    override fun onRegisterClick() {
        val ft = supportFragmentManager.beginTransaction()
        ft.setCustomAnimations(
            R.anim.slide_bottom_in,
            R.anim.slide_top_out,
            R.anim.slide_top_in,
            R.anim.slide_bottom_out
        )
        ft.replace(R.id.flContainer, registerFragment)
            .addToBackStack(null)
            .commit()
    }


    override fun onLoginClick() {
        supportFragmentManager.popBackStack()

    }
}